<%-- 
    Document   : cartview
    Created on : Apr 1, 2014, 4:04:42 PM
    Author     : Mona
--%>

<!DOCTYPE html>
<%@include file="header.jsp" %>

        <div class="top_bg">
            <div class="wrap">
                <div class="main_top">
                    <h2 class="style">Your Cart</h2>
                </div>
            </div>
        </div>
        <div class="container">
            <div class="row">
                <div class="col-md-6" style="margin-left: 60px;margin-top: 20px">
                    <div class="main_top">
                        <table class="table table-bordered table-hover" style="margin-top: 20px;">
                            <tr>
                                <th>Product Name</th>
                                <th> Price</th>
                                <th> Quantity </th>
                                <th>Total Price</th>
                                <th>Operations</th>
                            </tr>
                            <c:out value="${sum}" />                     
                            <c:set var="sum" value="0" ></c:set>
                            <c:forEach items="${cartItems}" var="row">

                                <tr>
                                    <td><c:out value="${row.name}" /> </td>
                                    <td><c:out value="${row.price}" /></td>
                                    <td><c:out value="${row.quantity}" /> </td>
                                    <td><c:out value="${row.quantity * row.price}" /></td>

                                    <td>
                                        <a href="CartDel?id=<c:out value="${row.id}"/>">Delete</a>
                                    </td>
                                </tr>
                                <c:set var="sum" value="${sum + row.quantity * row.price }" ></c:set>
                                </c:forEach>
                                </table>
                                 <b>Sum:</b> <br> <c:out value="${sum}"/>
                                
                                 <c:set var="limit" value="${limit}" ></c:set>
                                                     
                                 
                                     <form action="CartChanges" method="Post">
                                     <input type="hidden" value="${sum}" name="sum"  >
                                     <input style="padding-top:10px; float: right " class="btn btn-sm btn-success " type="submit" value="Buy"/>
                                 </form>
                                
                                 <div class="clear"></div>
                                 <br>
                    </div>
                </div>
            </div>
        </div>
     <%@ include file="footer.jsp" %>
